package supermarket;

//购物的测试
public class ShoppingTest {

    static SuperMarket superMarket;

    public static void main(String[] args) {
        init();

        shopping();
    }

    //实例化超市和商品信息和会员信息等

    private static void init() {
        superMarket = new SuperMarket();
        //设置超市的名称
        superMarket.setMarketName("泰克超市");


        Goods[] g = new Goods[5];
        for (int i = 0; i < g.length; i++) {
            g[i] = new Goods();
        }

        //g[0]==null
        g[0].setGoodsNumber(1);
        g[0].setGoodsName("手机");
        g[0].setPrice(125.5);

        g[1].setGoodsNumber(2);
        g[1].setGoodsName("平板");
        g[1].setPrice(250.0);


        g[2].setGoodsNumber(3);
        g[2].setGoodsName("鸡蛋");
        g[2].setPrice(1.5);

        g[3].setGoodsNumber(4);
        g[3].setGoodsName("苹果");
        g[3].setPrice(0.5);

        g[4].setGoodsNumber(5);
        g[4].setGoodsName("牛奶");
        g[4].setPrice(2.5);

        //初始化超市的商品
        superMarket.setGoodsList(g);


        Member[] m = new Member[2];

        for (int i = 0; i < m.length; i++) {
            m[i] = new Member();
        }
        m[0].setUserName("zhangsan");
        m[0].setPassWorld("123456");

        m[1].setUserName("lisi");
        m[1].setPassWorld("123456");
        //初始化超市的会员信息
        superMarket.setMembers(m);
    }

    private static void shopping() {
        System.out.println("----------------------欢迎来到" + superMarket.getMarketName() + "购物-------------");
    }
}
